package com.dnjn.happiness.biz.api;

import com.dnjn.happiness.biz.api.factory.RemoteCommunicateFallbackFactory;
import com.dnjn.happiness.common.core.constant.SecurityConstants;
import com.dnjn.happiness.common.core.constant.ServiceNameConstants;
import com.dnjn.happiness.common.core.domain.R;
import com.dnjn.happiness.common.core.model.CommunicateModel;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(contextId = "remoteCommunicateService",value = ServiceNameConstants.BIZ_SERVICE,fallbackFactory = RemoteCommunicateFallbackFactory.class)
public interface RemoteCommunicateService {

    @GetMapping("/admin/communicate/updateHappyWhenCommunicating/{userId}/{scoreTime}/{happinessScores}")
    void updateHappyWhenCommunicating(@PathVariable("userId")  Long userId,@PathVariable("scoreTime")  String scoreTime,@PathVariable("happinessScores") Integer happinessScores, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/admin/communicate/getCommunicateListByStatus/{status}")
    R<List<CommunicateModel>> getCommunicateListByStatus(@PathVariable("status") String status, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);


    @GetMapping("/admin/communicate/handleScoreEvent/{userId}/{score}")
    R<Boolean> handleScoreEvent(@PathVariable("userId") Long userId,@PathVariable("score") Integer score, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/admin/communicate/updateComSurvyId/{surveyId}/{communicateId}")
    public void updateComSurvyId(@PathVariable("surveyId") Long surveyId, @PathVariable("communicateId") Long communicateId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);


    @GetMapping("/admin/communicate/getResult")
    public R<CommunicateModel> getResult(@RequestParam("userId") Long userId, @RequestParam("lastTime") String lastTime, @RequestParam("scoreTime") String scoreTime, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/admin/communicate/getInfoById/{communicateId}")
    public R<CommunicateModel> getInfoById(@PathVariable("communicateId") Long communicateId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PutMapping("/admin/communicate/delCommunicate/{communicateId}")
    public R<Boolean> delCommunicate(@PathVariable("communicateId") Long communicateId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/admin/communicate/deleteByStatus/{value}")
    public R<Boolean> deleteByStatus(@PathVariable("value") String value, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/updateByCommunicateId/{modeladdResultsScore}/{defultsScore}/{format}/{communicateId}")
    public void updateByCommunicateId(@PathVariable("modeladdResultsScore") Double modeladdResultsScore, @PathVariable("defultsScore") Double defultsScore,@PathVariable("format") String format,@PathVariable("communicateId") Long communicateId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/admin/communicate/updateCommunicateDeleted/{communicateId}")
    public void updateCommunicateDeleted(@PathVariable("communicateId") Long communicateId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

}
